<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="../lib/html5.js"></script>
<script type="text/javascript" src="../lib/respond.min.js"></script>
<script type="text/javascript" src="../lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
    <link href="../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
<script type="text/javascript" src="../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>组件管理</title>
</head>
<body>
    <div class="pd-20">
        <form id="itemEdit" name="itemEdit" method="post" action="../ashx/spui.ashx" class="form form-horizontal">
            <input type="hidden" class="actionValue" id="editAction" name="action" value="add" />
            <input type="hidden" id="id" name="id" />
            <input type="hidden" id="tablename" name="tablename" value="" />
            <input type="hidden" id="tablemidname" name="tablemidname" value="" />
            <input type="hidden" id="ftype" name="ftype" value="20170516" />
            <input type="hidden" id="fmaintype" name="fmaintype" value="0" />
            <div class="row cl">
                <label class="form-label col-1"><span class="c-red">*</span>分类：</label>
                <div class="formControls col-2">
                    <span class="select-box">
                        <select class="select" size="1" name="ffv4" id="ffv4" nullmsg="请选择">
                            <option value="">请选择</option>
                            <option value="外购件">外购件</option>
                            <option value="电镀件">电镀件</option>
                            <option value="不处理件">不处理件</option>
                            <option value="喷涂件">喷涂件</option>
                        </select>
                    </span>
                </div>
                <div class="col-2"></div>
                <label class="form-label col-1"><span class="c-red">*</span>品名/图号：</label>
                <div class="formControls col-2">
                    <input type="text" class="input-text" name="ffv1" id="ffv1" nullmsg="不能为空" datatype="*2-20" placeholder="2~16个字符" />
                </div>
                <div class="col-2"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-1"><span class="c-red">*</span>规格/名称</label>
                <div class="formControls col-2">
                    <input type="text" class="input-text" name="ffv2" id="ffv2" nullmsg="不能为空" datatype="*1-16" placeholder="1~16个字符" />
                </div>
                <div class="col-2"></div>
                <label class="form-label col-1"><span class="c-red">*</span>数量：</label>
                <div class="formControls col-2">
                    <input type="text" class="input-text" name="fnv1" id="fnv1" datatype="/^-?[1-9]+(\.\d+)?$|^-?0(\.\d+)?$|^-?[1-9]+[0-9]*(\.\d+)?$/" />
                </div>
                <div class="col-2"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-1">单位：</label>
                <div class="formControls col-2">
                    <span class="select-box">
                        <select class="select" size="1" name="ffv5" id="ffv5" nullmsg="请选择">
                            <option value="">请选择</option>
                            <option value="Kg">Kg</option>
                            <option value="g">g</option>
                            <option value="件">件</option>
                            <option value="个">个</option>
                            <option value="条">条</option>
                            <option value="只">只</option>
                        </select>
                    </span>
                </div>
                <div class="col-2"></div>
                <label class="form-label col-1">备注：</label>
                <div class="formControls col-2">
                    <input type="text" class="input-text" name="ffv6" id="ffv6" />
                </div>
                <div class="col-2"></div>
            </div>

            <div class="row cl">
                <div class="col-6 col-offset-5">
                    <button class="btn btn-primary radius" type="submit" id="btsub1">提交</button>&nbsp;&nbsp;
				<button class="btn btn-secondary radius" type="button" id="btn_reset">重置</button>&nbsp;&nbsp;
				<button onclick="layer_close();" class="btn btn-default radius" type="button">返回</button>
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-1">序号：</label>
                <div class="formControls col-2">
                    <input type="text" class="input-text" name="gsnv1" id="gsnv1" datatype="n" />
                </div>
                <div class="col-1"></div>
                <label class="form-label col-1">工序：</label>
                <div class="formControls col-2">
                    <span class="select-box">
                        <select class="select" size="1" name="gsfv1" id="gsfv1"></select>
                    </span>
                </div>
                <div class="col-1"></div>
                <label class="form-label col-1">说明：</label>
                <div class="formControls col-2">
                    <input type="text" class="input-text" name="gsfv2" id="gsfv2" />
                </div>
                <div class="col-1"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-1">是否品检：</label>
                <div class="formControls col-2">
                    <span class="select-box">
                        <select class="select" size="1" name="gsfv3" id="gsfv3">
                            <option value="是">是</option>
                            <option value="否">否</option>
                        </select>
                    </span>
                </div>
                <div class="col-1"></div>
                <div class="col-3">
                    <button onclick="addZjGs();" class="btn btn-danger radius" type="button">添加</button>
                     <button onclick="UpdateZjGs();" class="btn btn-danger radius" type="button">保存</button>
                </div>
            </div>
            <div class="row cl">
                <table class="table table-border table-bordered table-striped table-hover" id="tablelist" width="100%">
                    <thead>
                        <tr class="text-c">
                            <th width="30"><a id="hcmtable_sall" onclick="hcmtable_sall();" href="javascript:;" title="全选反选"><i class="Hui-iconfont">&#xe608;全</i></a></th>
                            <th>序号</th>
                            <th>工序</th>
                            <th>说明</th>
                            <th>品检</th>
                            <th>操作</th>
                            <th>工序ID</th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        </form>
    </div>
    <script src="../hcjsui/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../lib/icheck/jquery.icheck.min.js"></script>
    <script type="text/javascript" src="../lib/Validform/5.3.2/Validform.js"></script>
    <script type="text/javascript" src="../lib/layer/1.9.3/layer.js"></script>
    <script src="../hcjsui/js/_Define.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/hcui.js"></script>
    <script type="text/javascript" src="../js/hcui_au.js"></script>

    <script type="text/javascript" src="../lib/datatables/1.10.0/jtable.js"></script>
    <script type="text/javascript" src="../js/hcui_list.js"></script>

    <script type="text/javascript" src="../lib/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        var Mfmaintype = 0;//生产的ID
        tablelistSelectType = 0;//1行多选(默认) 0行单选  
        //加载处理
        function loadin() {
            if (getUrlParam("action") == "add") {
                Mfmaintype = getUrlParam("maintype");
                $("#fmaintype").val(Mfmaintype);
            }
            //本页面 
            spsetBase("Table_SP", "id", "Table_SP as T", "*", "#tablelist", "newui", "组件明细", "newui");
            //数据加载

            hcdosel("id,fv1 as name", "Table_SP", "type=20170505", "", "", "nv1", function (data) { SetSelectWithObjIdName("#gsfv1", data); });
        }
        function addZjGs() {
            var addinfo = "type%20170520$maintype%" + aumid + "$nv1%" + $("#gsnv1").val()
                + "$fv1%" + $("#gsfv1").val() + "$fv4%" + $("#gsfv1").find("option:selected").text()
                + "$fv2%" + $("#gsfv2").val()
                + "$fv3%" + $("#gsfv3").val()
                + "$nv2%" + Mfmaintype;
            hcdoadd("table_sp", addinfo, function (info) {
                if (info == "ok") hcmtable.ajax.reload();
            });
        }

        function UpdateZjGs() {
            var addinfo = "type%20170520$maintype%" + aumid + "$nv1%" + $("#gsnv1").val()
                + "$fv1%" + $("#gsfv1").val() + "$fv4%" + $("#gsfv1").find("option:selected").text()
                + "$fv2%" + $("#gsfv2").val()
                + "$fv3%" + $("#gsfv3").val()
                + "$nv2%" + Mfmaintype;
            hcdoedit("table_sp", "id", thisGsId, addinfo, function (info) {
                if (info == "ok" || info == "更新成功") hcmtable.ajax.reload();
            });
        }
        var thisGsId = 0;
        function LoadZjGs(id) {
            var rowdata = hcdosel("*", "table_sp", "id=" + id, "", "", "", function (data) {
                var rowdata = JSON.parse(data);
                thisGsId = rowdata[0].id;
                $("#gsnv1").val(rowdata[0].nv1);
                $("#gsfv1").val(rowdata[0].fv1);
                $("#gsfv2").val(rowdata[0].fv2);
                $("#gsfv3").val(rowdata[0].fv3);
            });
           
        }
        function loadback(data) {
            if (aumid) {
                hcmtable = $("#tablelist").DataTable({
                    "serverSide": true,//服务端处理分页 无法使用当前查找
                    "bFilter": false,  //是否使用内置的过滤功能
                    //"bInfo": false,//页脚信息
                    //"bPaginate": false, //翻页功能
                    "bLengthChange": false, //改变每页显示数据数量
                    "ajax": {
                        "type": "POST",
                        "url": sposelUrl("table_sp", "id,fv1,fv2,fv3,fv4,fv5,fv6,nv1", " and type=20170520 and maintype=" + aumid) + "&sporderby=nv1",
                        "data": function (d) {
                        }
                    },
                    aLengthMenu: [100],
                    "columns": [
                         { "data": "id" }
    , { "data": "nv1" }
 , { "data": "fv4" }
   , { "data": "fv2" }
   , { "data": "fv3" }
    , { "data": "id" }, { "data": "fv1" }

                    ],
                    "columnDefs": [

                        {
                            "targets": [5],
                            "render": function (data, type, row) {
                                return "<a style=\"text-decoration:none\" class=\"ml-5\" onclick=\"LoadZjGs(" + row.id + ")\" href=\"javascript:;\" title=\"编辑\"><i class=\"Hui-iconfont\">&#xe6df;编辑</i></a> " +
                                       "<a style=\"text-decoration:none\" class=\"ml-5\" onclick=\"toolDelete('" + data + "','table_sp','id')\"     href=\"javascript:;\" title=\"删除\"><i class=\"Hui-iconfont\">&#xe6e2;删除</i></a>";
                            }
                        },

                    {
                        "orderable": false,
                        "targets": [0, 1, 2, 3, 4, 5]
                    },
                    {
                        "targets": [6],
                        "visible": false
                    }
                    ]
                });
            }

        }


    </script>
</body>
</html>
